home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="html" indent="yes" />
-
- <xsl:include href="Min.xsl" />
-
- <xsl:template match="/">
- <html>
- <head>
- <title>Stylesheet Example</title>
- <style type="text/css"><![CDATA[
- H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
- TD {COLOR: darkblue; FONT-FAMILY: Arial}
- TR { background-color: beige; }
- BODY { background-color: beige; }
- ]]></style>
- </head>
- <body>
- <xsl:apply-templates />
- </body>
- </html>
- </xsl:template>
-
- <xsl:template match="weather">
- <h1>Temperatures for: 01/21/2001 - 01/28/2001</h1>
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="temperatures">
- <h2>City:
- <xsl:value-of select="@city" />
- </h2>
- <!-- Display Table Headers -->
- <table border="1">
- <tr>
- <th>date</th>
- <th>Temperatue(F)</th>
- </tr>
- <!-- Display each temperature for the city as a row in the table -->
- <xsl:for-each select="temperature">
- <tr>
- <td>
- <xsl:value-of select="@date" />
- </td>
- <td>
- <xsl:value-of select="." />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- <!-- Display Call the "Min" template to determine the
- minimum temperature for the temperature nodes-->
- <xsl:variable name="nMinTemp">
- <xsl:call-template name="Min">
- <xsl:with-param name="list" select=".//temperature" />
- <xsl:with-param name="nMin" select="'99999'" />
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Display the minimum temperature calculated by the Min template-->
- <h3>The lowest temperature is:
- <xsl:value-of select="$nMinTemp" />
- </h3>
-
- <br />
- </xsl:template>
- </xsl:stylesheet>